class Order < ActiveRecord::Base
  PAYMENT_TYPES = [
    ["Check","check"],
    ["Credit Cart", "cc"],
    ["Purchase Order","po"]
  ].freeze
  has_many :line_items
  validates_presence_of :name, :email, :address, :pay_type
  def self.pending_shipping
    find(:all,
	 :conditions=>"shipped_at is null"
	)
  end
  def mark_as_shipped
    self.shipped_at = Time.now
  end
  def self.count_pending
    count("shipped_at is null")
  end
end
